<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <title>排班表</title>
    <link href="https://cdn.bootcdn.net/ajax/libs/twitter-bootstrap/5.1.3/css/bootstrap.min.css" rel="stylesheet">
    <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap-icons@1.8.1/font/bootstrap-icons.css">
    <style>
        .schedule-container {
            max-width: 1000px;
            margin: 0 auto;
            padding: 2rem;
        }
        .schedule-title {
            color: #0d6efd;
            margin-bottom: 1.5rem;
            text-align: center;
        }
        .shift-morning {
            background-color: #d1e7dd;
        }
        .shift-afternoon {
            background-color: #fff3cd;
        }
        .shift-night {
            background-color: #f8d7da;
        }
        .badge {
            font-size: 0.85em;
            padding: 0.35em 0.65em;
        }
        .table-responsive {
            border-radius: 8px;
            box-shadow: 0 0 15px rgba(0,0,0,0.1);
        }
    </style>
</head>
<body class="bg-light">
    <div class="schedule-container">
        <h2 class="schedule-title">
            <i class="bi bi-calendar-week"></i> 排班表
        </h2>
        
        <div class="d-flex justify-content-between mb-4">
            <a href="{% url 'generate' %}" class="btn btn-primary">
                <i class="bi bi-plus-circle"></i> 新建排班
            </a>
            <div>
                <span class="badge bg-success me-2">早班</span>
                <span class="badge bg-warning me-2">中班</span>
                <span class="badge bg-danger">晚班</span>
            </div>
        </div>
        
        <div class="table-responsive">
            <table class="table table-hover align-middle">
                <thead class="table-light">
                    <tr>
                        <th>日期</th>
                        <th>星期</th>
                        <th>员工</th>
                        <th>班次</th>
                    </tr>
                </thead>
                <tbody>
                    {% for shift in shifts %}
                    <tr class="shift-{{ shift.shift_type|lower }}">
                        <td>{{ shift.shift_date|date:"Y年m月d日" }}</td>
                        <td>{{ shift.shift_date|date:"l" }}</td>
                        <td>{{ shift.employee.name }}</td>
                        <td>
                            <span class="badge bg-{% if shift.shift_type == 'M' %}success{% elif shift.shift_type == 'A' %}warning{% else %}danger{% endif %}">
                                {{ shift.get_shift_type_display }}
                            </span>
                        </td>
                    </tr>
                    {% endfor %}
                </tbody>
            </table>
        </div>
    </div>
    
    <!-- Bootstrap JS Bundle with Popper -->
    <script src="https://cdn.bootcdn.net/ajax/libs/twitter-bootstrap/5.1.3/js/bootstrap.bundle.min.js"></script>
    
    <!-- 添加中文日期本地化支持 -->
    <script src="https://cdn.bootcdn.net/ajax/libs/moment.js/2.29.1/moment.min.js"></script>
    <script src="https://cdn.bootcdn.net/ajax/libs/moment.js/2.29.1/locale/zh-cn.js"></script>
    <script>
        // 初始化中文语言包
        moment.locale('zh-cn');
    </script>
</body>
</html>